package cn.liyicun.cp.cpweb.task;

import cn.hutool.core.map.MapUtil;
import cn.liyicun.cp.cpweb.service.ExpectInfoService;
import cn.liyicun.cp.cpweb.service.SettingInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class AddExpectTask {
    @Autowired
    ExpectInfoService expectInfoService;

    @Autowired
    private SettingInfoService settingInfoService;

    //每天一点生产数据
    @Scheduled(cron = "1 1 1 * * ?")
    public void run() {
        Map<String, String> map = settingInfoService.mapCache("apicp");
        String codes = MapUtil.getStr(map, "code");
        String[] strs = codes.split(",");
        for (String code : strs) {
            expectInfoService.task(code);
        }


    }
}
